Skip to content

🐛 fix(sqlite): finalize uncached statements promptly - #1348

Open
gaborbernat wants to merge 1 commit into
oracle:masterfrom
gaborbernat:fix/sqlite-no-cache
Open

gaborbernat wants to merge 1 commit into
oracle:masterfrom
gaborbernat:fix/sqlite-no-cache

Conversation

@gaborbernat

Copy link
Copy Markdown

With statement caching disabled, closing a cursor and its connection can leave the database descriptor open until garbage collection. Filelock relies on explicit closure to reuse its SQLite connections safely. Issue #1347

Connections with caching disabled now prepare statements in the native extension. This keeps their lifetime tied to the cursor. Connections with a positive cache size continue to use the LRU wrapper.

I built the patched SQLite extension against GraalPy 25.6.5 on Linux. The descriptor regression fails with the released extension and passes with the patched build. All seven Filelock assertions that failed with the released extension also passed.

Fixes #1347

Routing uncached statements through the managed LRU wrapper leaves
finalization to garbage collection. Prepare them natively when caching
is disabled so closing the cursor releases the SQLite statement.

Refs oracle#1347

Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite retains the database descriptor after closing an uncached query

1 participant